home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / dev / c / cweb31p9d.lha / CWeb / arexx / compile.ced next >
Text File  |  1993-12-06  |  5KB  |  212 lines

  1. /*rx
  2.  *  Compile.ced ... ARexx program to compile and review error/warning
  3.  *  messages in SAS/C 6.3 programs while within CED Pro 3.5.
  4.  *  Requires (minimum tested versions): ARexx 1.15, SAS/C 6.3, CED Pro 3.5
  5.  *
  6.  *  Copyright © 1992, 1993  Loren J. Rittle
  7.  *  Copyright © 1993 Andreas Scherer
  8.  *
  9.  *  Use as you will, just document your changes and keep the copyright and
  10.  *  header comment notice intact.  SAS and ASDG have explicit permission to
  11.  *  include this work in their respective compiler/editor packages.  All
  12.  *  other commercial use is prohibited.  This ARexx program must be
  13.  *  distributed in source form.  This work is provided in the hopes that
  14.  *  it will be useful, but no warranty is implied or given.
  15.  *
  16.  *  Based upon past non-scmsg based versions of Compile.ced,
  17.  *  Copyright © 1990, 1991  Loren J. Rittle
  18.  *
  19.  *  Loren J. Rittle (rittle@comm.mot.com)
  20.  *  Sun Apr 18 03:06:46 1993
  21.  *
  22.  *  This script works with Cygnus Ed Professional V3.5+ and is
  23.  *  incompatible with earlier versions of this fine editor.
  24.  *  Changes for CED 3.5 support are
  25.  *  Copyright © 1993 Andreas Scherer
  26.  *
  27.  *  Sun Oct 10 15:00:00 1993
  28.  *
  29.  *  Notes:
  30.  *
  31.  *  Your env:sc/SCMSG file should contain lines that look something
  32.  *  like the following to work with CED 3.5:
  33.  *
  34.  *        PORTNAME rexx_ced
  35.  *        EDITCOMMAND ed %f
  36.  *        GOTOFILE OW "%f\n"
  37.  *        GOTOLINE LL "%l\n" DM %m
  38.  *
  39.  *  Your env:sc/SCOPTIONS file should contain the following line:
  40.  *
  41.  *        ERRORREXX
  42.  *
  43.  *  I bind this macro to F7.  Hit once to compile (actually (s)make),
  44.  *  then again to step through the errors.  Every visited error is
  45.  *  removed from the message database.  If the last error was visited,
  46.  *  the message database can be rebuilt.  To quit the loop in this
  47.  *  script, send the 'quit' command to SCMSG (via DOS or ARexx)
  48.  */
  49.  
  50. /* NO GENERAL USER MODIFIABLE PARTS BELOW THIS COMMENT. */
  51.  
  52. options results
  53. options failat 31
  54.  
  55. /*
  56.  *  Somehow the working paths of CED and SCMSG aren't the same.
  57.  *  Force this to be the path of the current CED view.
  58.  */
  59. Status 19
  60. FULLNAME = RESULT
  61.  
  62. IVOL     = Index(FULLNAME,":")
  63. IDIRS    = LastPos("/",SubStr(FULLNAME,1+IVOL))
  64. FILEONLY = SubStr(FULLNAME,IVOL+1+IDIRS)
  65. IBASE    = LastPos(".",FILEONLY)
  66.  
  67. If 0 = IBASE Then
  68.   IBASE = Length(FILEONLY)
  69. Else
  70.   IBASE = IBASE - 1
  71.  
  72. PATHNAME = Left(FULLNAME,IVOL+IDIRS)
  73. FILENAME = SubStr(FULLNAME,IVOL+IDIRS+1,IBASE)
  74.  
  75. Pragma('Directory',PATHNAME)
  76.  
  77. Drop IVOL IDIRS FILEONLY IBASE
  78.  
  79. /*
  80.  *  Make sure that SCMSG is running.  The error messages are not
  81.  *  displayed in a SCMSG window but in the information line of CED 3.5.
  82.  *  This feature can not be used with earlier versions of CED.
  83.  */
  84. address command 'run <nil: >nil: sc:c/scmsg rexxonly'
  85. address command 'waitforport SC_SCMSG'
  86.  
  87. address SC_SCMSG 'errnum'
  88. if "" = RESULT then do
  89.     DM
  90.     'okay2' 'Rebuild error/warning database?'
  91.     if result then
  92.       do
  93.     address SC_SCMSG 'clear'
  94.     some_changes = 0
  95.     status 66; views = result
  96.     do i = 1 to views-1
  97.       'next view'
  98.       status 18; changes = result
  99.       if changes ~= 0 then
  100.         some_changes = 1
  101.     end
  102.     'next view'
  103.     if some_changes then
  104.       do
  105.         'okay2' 'Save all changes?'
  106.         if result then
  107.           'save all changes'
  108.         else
  109.           do
  110.         status 18; changes = result
  111.         if changes ~= 0 then
  112.           do
  113.             'okay2' 'Save changes to this one file at least?'
  114.             if result then
  115.               'save'
  116.           end
  117.           end
  118.       end
  119.     else
  120.       do
  121.         status 18; changes = result
  122.         if changes ~= 0 then
  123.           do
  124.         'okay2' 'Save changes to this file?'
  125.         if result then
  126.           'save'
  127.           end
  128.       end
  129.     'getstring' "'smake <nil: >nil: -sk "||FILENAME||"' 'Enter command to rebuild database:'"
  130.     commandline = result
  131.     if word(commandline,1) = 'smake' then
  132.       if ~exists('makefile') & ~exists('smakefile') then
  133.         do
  134.           'okay2' 'Warning: No [s]makefile, continue?'
  135.           if ~result then
  136.         commandline = 'RESULT'
  137.         end
  138.     if commandline = 'RESULT' then
  139.       do
  140.         status 19; filename = result
  141.         commandline = 'sc' filename
  142.         'okay2' 'Would you like to execute "'commandline'" instead?'
  143.         if ~result then do
  144.           DM
  145.           exit 0
  146.         end
  147.       end
  148.  
  149.     address command commandline
  150.     commandrc = rc
  151.  
  152.         address SC_SCMSG 'errnum'
  153.         if "" = RESULT then do
  154.         if commandrc = 0 then
  155.           'okay1' 'No errors/warnings.'
  156.         else
  157.           'okay1' 'Improper build or bad command.'
  158.         DM
  159.         exit 0
  160.           end
  161.       end
  162.     else
  163.       do
  164.     address SC_SCMSG 'errnum'
  165.     if result = '' then do
  166.       DM
  167.       exit 0
  168.     end
  169.     'okay2' 'Recycle through error/warning database?'
  170.     if result then
  171.       address SC_SCMSG 'next'
  172.     else
  173.       do
  174.         address SC_SCMSG 'prev'
  175.         DM
  176.         exit 0
  177.       end
  178.       end
  179.   end
  180.  
  181. address SC_SCMSG 'file'
  182. file = result
  183. address SC_SCMSG 'line'
  184. line = result
  185.  
  186. OW file
  187. LL line
  188.  
  189. address SC_SCMSG 'altfile'
  190. altfile = result
  191. if altfile ~= '' then
  192.   do
  193.     address SC_SCMSG 'altline'
  194.     altline = result
  195.     if PATHNAME||altfile = FULLNAME Then
  196.       split view
  197.     else
  198.       OW altfile
  199.     LL altline
  200.   end
  201.  
  202. address SC_SCMSG 'errnum'
  203. errornumber = result
  204.  
  205. address SC_SCMSG 'class'
  206. class = result
  207.  
  208. address SC_SCMSG 'text'
  209. DM class errornumber':' result
  210.  
  211. address SC_SCMSG 'delete'
  212.